package cn.mysdp.biz.controller;


import cn.mysdp.biz.controller.*;
import cn.mysdp.biz.dto.request.*;
import cn.mysdp.biz.dto.response.*;

import java.util.List;

import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName: SdpProjectWebController
 * @Description:
 * @Author: SDP
 * @Date: 2021-10-30
 * @Version: 1.0
 * Table: sdp_project
 * Comment:
 * 
 */
@RestController
@RequestMapping(value = "/sdp_project")
public class SdpProjectWebController extends SdpProjectWebCustomController {
    static {
        addRequestClass("sdp_project", "add", "sdpProjectController", SdpProjectWebController.class, SdpProjectAddRequest.class);
        addRequestClass("sdp_project", "add_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectAddRequest.class);

        addRequestClass("sdp_project", "update", "sdpProjectController", SdpProjectWebController.class, SdpProjectUpdateRequest.class);
        addRequestClass("sdp_project", "update_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectUpdateRequest.class);

        addRequestClass("sdp_project", "delete", "sdpProjectController", SdpProjectWebController.class, SdpProjectDeleteRequest.class);
        addRequestClass("sdp_project", "delete_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectDeleteRequest.class);

        addRequestClass("sdp_project", "query", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);
        addRequestClass("sdp_project", "query_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);

        addRequestClass("sdp_project", "list", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);
        addRequestClass("sdp_project", "list_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);

        addRequestClass("sdp_project", "count", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);
        addRequestClass("sdp_project", "count_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);

        addRequestClass("sdp_project", "stat", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);
        addRequestClass("sdp_project", "stat_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectQueryRequest.class);

    }

    @PostMapping("/add")
    public Integer addSdpProject(@RequestBody SdpProjectAddRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "add", request, callFromEncrypt);
        return super.addSdpProject(request);
    }

    @PostMapping("/add_encrypt")
    public String addSdpProjectEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectAddRequest request = (SdpProjectAddRequest) super.decrypt("sdp_project", "add_encrypt", strRequest, SdpProjectAddRequest.class);
        Integer result = addSdpProject(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/update")
    public Integer updateSdpProject(@RequestBody SdpProjectUpdateRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "update", request, callFromEncrypt);
        return super.updateSdpProject(request);
    }

    @PostMapping("/update_encrypt")
    public String updateSdpProjectEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectUpdateRequest request = (SdpProjectUpdateRequest) super.decrypt("sdp_project", "update_encrypt", strRequest, SdpProjectUpdateRequest.class);
        Integer result = updateSdpProject(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/delete")
    public Integer deleteSdpProject(@RequestBody SdpProjectDeleteRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "delete", request, callFromEncrypt);
        return super.deleteSdpProject(request);
    }

    @PostMapping("/delete_encrypt")
    public String deleteSdpProjectEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectDeleteRequest request = (SdpProjectDeleteRequest) super.decrypt("sdp_project", "delete_encrypt", strRequest, SdpProjectDeleteRequest.class);
        Integer result = deleteSdpProject(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/query")
    public SdpProjectQueryResponse querySdpProject(@RequestBody SdpProjectQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("sdp_project", "query", request, callFromEncrypt);
      SdpProjectQueryResponse result = super.querySdpProject(request);
      super.fixResult("sdp_project", "query", request);
      return result;
    }

    @PostMapping("/query_encrypt")
    public String querySdpProjectEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectQueryRequest request = (SdpProjectQueryRequest) super.decrypt("sdp_project", "query_encrypt", strRequest, SdpProjectQueryRequest.class);
        SdpProjectQueryResponse result = querySdpProject(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/list")
    public List<SdpProjectQueryResponse> listSdpProject(@RequestBody SdpProjectQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "list", request, callFromEncrypt);
        List<SdpProjectQueryResponse> list = super.listSdpProject(request);
        super.fixResult("sdp_project", "list", list);
        return list;
    }

    @PostMapping("/list_encrypt")
    public String listSdpProjectEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectQueryRequest request = (SdpProjectQueryRequest) super.decrypt("sdp_project", "list_encrypt", strRequest, SdpProjectQueryRequest.class);
        List<SdpProjectQueryResponse> result = listSdpProject(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/count")
    public Integer countSdpProject(@RequestBody SdpProjectQueryRequest request, Integer callFromEncrypt) throws Exception {
      super.fixRequest("sdp_project", "count", request, callFromEncrypt);
      return super.countSdpProject(request);
    }


    @PostMapping("/count_encrypt")
    public String countSdpProjectEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectQueryRequest request = (SdpProjectQueryRequest) super.decrypt("sdp_project", "count_encrypt", strRequest, SdpProjectQueryRequest.class);
        Integer result = countSdpProject(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    @PostMapping("/stat")
    public BaseStatResponse statSdpProject(@RequestBody SdpProjectQueryRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "stat", request, callFromEncrypt);
        return super.statSdpProject(request);
    }

    @PostMapping("/stat_encrypt")
    public String statSdpProjectEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectQueryRequest request = (SdpProjectQueryRequest) super.decrypt("sdp_project", "stat_encrypt", strRequest, SdpProjectQueryRequest.class);
        BaseStatResponse result = statSdpProject(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);

        return super.encrypt(request, response);
    }

    static {
        addRequestClass("sdp_project", "execute", "sdpProjectController", SdpProjectWebController.class, SdpProjectForExecuteRequest.class);
        addRequestClass("sdp_project", "execute_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectForExecuteRequest.class);
    }

    @PostMapping("/execute")
    public SdpProjectForExecuteResponse execute(@RequestBody SdpProjectForExecuteRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "execute", request, callFromEncrypt);
        SdpProjectForExecuteResponse result = super.execute(request);
        super.fixResult("sdp_project", "execute", request);
        return result;
    }

    @PostMapping("/execute_encrypt")
    public String executeEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectForExecuteRequest request = (SdpProjectForExecuteRequest)decrypt("sdp_project", "execute_encrypt", strRequest, SdpProjectForExecuteRequest.class);
        SdpProjectForExecuteResponse result = execute(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);
        
        return super.encrypt(request, response);
    }

    static {
        addRequestClass("sdp_project", "shell", "sdpProjectController", SdpProjectWebController.class, SdpProjectForShellRequest.class);
        addRequestClass("sdp_project", "shell_encrypt", "sdpProjectController", SdpProjectWebController.class, SdpProjectForShellRequest.class);
    }

    @PostMapping("/shell")
    public SdpProjectForShellResponse shell(@RequestBody SdpProjectForShellRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "shell", request, callFromEncrypt);
        SdpProjectForShellResponse result = super.shell(request);
        super.fixResult("sdp_project", "shell", request);
        return result;
    }

    @PostMapping("/shell_encrypt")
    public String shellEncrypt(@RequestBody String strRequest) throws Exception {
        SdpProjectForShellRequest request = (SdpProjectForShellRequest)decrypt("sdp_project", "shell_encrypt", strRequest, SdpProjectForShellRequest.class);
        SdpProjectForShellResponse result = shell(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);
        
        return super.encrypt(request, response);
    }


    static {
        addRequestClass("sdp_project", "clone", "sdpProjectController", SdpProjectWebController.class, BaseNameIdRequest.class);
        addRequestClass("sdp_project", "clone_encrypt", "sdpProjectController", SdpProjectWebController.class, BaseNameIdRequest.class);
    }
    
    @ResponseBody
    @PostMapping("/clone")
    public Integer clone(@RequestBody BaseNameIdRequest request, Integer callFromEncrypt) throws Exception {
        super.fixRequest("sdp_project", "clone", request, callFromEncrypt);
        Integer result = super.clone(request);
        super.fixResult("sdp_project", "clone", request);
        return result;
    }

    @ResponseBody
    @PostMapping("/clone_encrypt")
    public String cloneEncrypt(@RequestBody String strRequest) throws Exception {
        BaseNameIdRequest request = (BaseNameIdRequest)decrypt("sdp_project", "clone_encrypt", strRequest, BaseNameIdRequest.class);
        Integer result = clone(request, 1);
        if (result == null) {
            return null;
        }
        String response = toJSONString(result);
        
        return super.encrypt(request, response);
    }

}
